<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<xsl:decimal-format name="european" decimal-separator="," grouping-separator="."/>
	<xsl:output method="html"/>
	<xsl:template match="root">
		<html>
			<body style="font-family:Arial,Helvetica,sans-serif; margin: 10px;">
				<xsl:apply-templates select="//project"/>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="project">
		<table border="0" cellspacing="5">
			<tr>
				<td width="80%"><div class="project" style="font-size:20pt; text-align:center;"><xsl:value-of select="name"/></div></td>
			</tr>
			<tr>
				<td width="80%">
					<table border="0" style="width:100%;" cellpadding="5">
						<tr>
							<td><div style="padding:0 0 2px 0; border-bottom:1px solid #cccccc; font-size: 16pt; color:#444444;">Implemented Stories</div></td>
						</tr>
						<tr>
							<td align="center"><xsl:apply-templates select="//userstory[usedTime != '00:00:00']"/></td>
						</tr>
					</table>
					<br/>
					<table border="0" style="width:100%;" cellpadding="5">
						<tr>
							<td><div style="padding:0 0 2px 0; border-bottom:1px solid #cccccc; font-size: 16pt; color:#444444;">Unimplemented Stories</div></td>
						</tr>
						<tr>
							<td align="center"><xsl:apply-templates select="//userstory[usedTime = '00:00:00']"/></td>
						</tr>
					</table>
				</td>
				<td valign="top" align="center">
					<table border="0" width="80%" style="border: 1px solid rgb(204, 204, 204);">
						<tr bgcolor="#c3d9ff">
							<th align="left">Info</th>
						</tr>
						<tr>
							<td style="font-family:Arial,Helvetica,sans-serif;">
								The red boxes indentify the &quot;spike&quot; cards which
								are Userstories used to perform experiments on new technologies.
							</td>
						</tr>
					</table>
					<br/><br/>
					<table border="0" width="80%" style="border: 1px solid rgb(204, 204, 204);">
						<tr bgcolor="#c3d9ff">
							<th align="left">Project Statistics</th>
						</tr>
						<tr>
							<td>
								<table border="0" width="100%">
									<tr>
										<td>Total Implemented:</td><td align="right"><xsl:value-of select="count(//userstory[usedTime != '00:00:00'])"/></td>
									</tr>
									<tr>
										<td>Total Open:</td><td align="right"><xsl:value-of select="count(//userstory[usedTime = '00:00:00'])"/></td>
									</tr>
									<tr>
										<td/><td><hr/></td>
									</tr>
									<tr>
										<td>Total Stories:</td><td align="right"><xsl:value-of select="count(//userstory)"/></td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</xsl:template>
	
	<xsl:template match="userstory">
		<xsl:variable name="isExperimental" select="experimental"/>
		
		<xsl:choose>
			<xsl:when test="$isExperimental='true'">
				<table border="0" cellspacing="0" cellpadding="5" style="width:60%; border-color: #FFCC33; border:1px solid #3366CC;">
					<tr style="background-color:red;">
						<td style="width:80%; font-weight:bold; font-size:14pt;"><xsl:value-of select="name"/></td>
						<td align="center" valign="center" style="border: 1px solid black;">Risk: <xsl:value-of select="risk"/></td>
						<td align="center" valign="center" style="border: 1px solid black;">Est.: <xsl:value-of select="estimatedTime"/></td>
						<td align="center" valign="center" style="border: 1px solid black;">Used: <xsl:value-of select="usedTime"/></td>
						<td align="center" valign="center" style="border: 1px solid black;">Bus.Val.: <xsl:value-of select="businessValue"/></td>
					</tr>
					<tr>
						<td colspan="4">
							<xsl:value-of select="description"/>
						</td>
					</tr>
				</table>
			</xsl:when>
			<xsl:when test="$isExperimental='false'">
				<table border="0" cellspacing="0" cellpadding="5" style="width:60%; border-color: #FFCC33; border:1px solid #3366CC;">
					<tr style="background-color:#FFF4C2;">
						<td style="width:80%; font-weight:bold; font-size:14pt;"><xsl:value-of select="name"/></td>
						<td align="center" valign="center" style="border: 1px solid black;">Risk: <xsl:value-of select="risk"/></td>
						<td align="center" valign="center" style="border: 1px solid black;">Est.: <xsl:value-of select="estimatedTime"/></td>
						<td align="center" valign="center" style="border: 1px solid black;">Used: <xsl:value-of select="usedTime"/></td>
						<td align="center" valign="center" style="border: 1px solid black;">Bus.Val.: <xsl:value-of select="businessValue"/></td>
					</tr>
					<tr>
						<td colspan="4">
							<xsl:value-of select="description"/>
							
							<!--
							<textarea style="width:100%; height:300px;" wrap="off" editable="false">
								<xsl:value-of select="description"/>
							</textarea>-->
						</td>
					</tr>
				</table>
			</xsl:when>
		</xsl:choose>
		
		<br/>
	</xsl:template>
	
	<!-- for choosing if Auswertung has been done for Kunde or Verkaufsgebiet -->
	<xsl:template match="kunde">
		<tr>
			<xsl:variable name="value" select="name"/>
			<xsl:choose>
				<xsl:when test="not($value='')">
					<td>Kunde:</td>
					<td><xsl:value-of select="name"/></td>
				</xsl:when>
				<xsl:when test="$value=''">
					<td>Verkaufsgebiet:</td>
					<td><xsl:value-of select="//verkaufsgebiet/name"/></td>
				</xsl:when>
				<xsl:otherwise>
					<td>[Fehler]:</td>
					<td><i>Fehler in Auswertungsanzeige</i></td>
				</xsl:otherwise>
			</xsl:choose>
		</tr>
	</xsl:template>
	
	<!-- Template for matching the Verpackung-list -->
	<xsl:template match="verpackung">
		<tr>
			<td><xsl:value-of select="verpacktyp"/></td>
			<td><xsl:value-of select="name"/></td>
			<td/>
			<td/>
			<td>Kosten:</td>
			<td><xsl:value-of select="format-number(price, '#.##0,00', 'european')"/></td>
		</tr>
	</xsl:template>
	
	<xsl:template match="kostenpunkt">
		<tr>
			<td><xsl:value-of select="kostenart"/></td>
			<td/>
			<td/>
			<td/>
			<td>Kosten</td>
			<td><xsl:value-of select="format-number(kosten, '#.##0,00', 'european')"/></td>
		</tr>
	</xsl:template>
</xsl:stylesheet>